package com.zhang.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhang.pojo.LogBean;
import com.zhang.service.ILogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@Api(tags = "日志控制接口")
@RestController
@RequestMapping("log")
public class LogController {

    @Autowired
    private ILogService logService;

    @ApiOperation("根据日志起始、结束日期动态查询并分页")
    @GetMapping("findByPageAndItem")
    public IPage<LogBean> findByPageAndItem(int current,
                                            int pageSize,
                                            LocalDate start,
                                            LocalDate end){
       return logService.findByPageAndItem(new Page<>(current,pageSize),start,end);
    }


}
